|
|
|
|
|
|
|
As you've just seen, the SDI design is really quite easy to put together. The next section covers how you can use the MDI interface design to create the same type of application. |
|
|
|
|
|
|
|
|
Now that you've seen how to create a Notepad-type application with a Single Document Interface, see what it takes to create it with a Multiple Document Interface (MDI) design. To start, this interface allows you to create an application that contains multiple forms within a single container form, called a parent. When working with an MDI application, you can open multiple windows at the same time and access them from a menu; then, when you minimize the application, all the document windows are minimized with only the parent window's icon appearing in the taskbar. |
|
|
|
|
|
|
|
|
Reviewing the Parent and Child Forms |
|
|
|
|
|
|
|
|
The parent form is the container for all child forms in the application. This form has a number of unique characteristics that define how it behaves: |
|
|
|
|
|
|
|
|
An application can have only one MDI form. |
|
|
|
|
|
|
|
|
Only controls that support the Align property can be placed directly on an MDI form. |
|
|
|
|
|
|
|
|
You can't use the Print method or any graphics methods to display data on an MDI form. |
|
|
|
|
|
|
|
|
When you minimize the parent form, it and all its child windows are seen as a single icon on the desktop. When the parent form is restored, all the child forms are returned to their original positions and sizes. |
|
|
|
|
|
|
|
|
If the active child form has a menu, it's displayed on the MDI form's menu bar. |
|
|
|
|
|
|
|
|
The child form also has certain characteristics that affect its behavior: |
|
|
|
|
|
|
|
|
Each displayed child window remains within the parent window. It also can't be moved outside the parent window's boundaries. |
|
|
|
|
|
|
|
|
When a child form is minimized, its icon is displayed within the parent window, not on the taskbar. |
|
|
|
|
|
|
|
|
A maximized child window completely fills the parent form's work area. Its title also is combined with the parent's title and displayed in the parent's title bar. |
|
|
|
|
|
|
|
|
When a child form is maximized, any other child forms are also maximized with it. |
|
|
|
|
|
|
|
|
When you're designing the application, you'll work with each form, parent or child, independently of the others. To know which are child forms, standard forms, or parent forms, you just need to look at the related icon in the Project Explorer window (see Figure 3.7). |
|
|
|
|
|